package phoenix.workers.db;

import core.config.Config;
import phoenix.core.PhoenixManager;
import phoenix.core.base.TestSuiteBase;

/**
 * Created by AlexGolovko on 11.09.2014.
 */
public class DbCleaner extends TestSuiteBase
{
	public static void main(String args[])
	{
		if (phoenix == null)
		{
			phoenix = new PhoenixManager();
			// Use Build
			Config.BUILD = "live";

			phoenix.db().connect(
				phoenix.config().DB_HOST,
				phoenix.config().DB_PORT,
				phoenix.config().DB_NAME,
				phoenix.config().DB_USER,
				phoenix.config().DB_PASSWORD);
		}

		try
		{
			// Every reboot, we do clean for records left with status "In progress"
			phoenix.db().query("delete from tests where status = '2' AND browser != 'android'");
		}
		catch (Exception p_ex)
		{
			phoenix.log().error("Something went wrong in db cleaner " + p_ex);
		}
	}
}
